<template>
  <div>
    <button @click="addAge">点我修改父组件数据</button>
  </div>
</template>

<script>
export default {
  name: 'aaaBBB',
  // 接收父组件传入的数据
  props: {
    age: {
      type: Number,
      required: true
    },
    uname: {
      type: String,
      required: true
    }
  },
  // 接收父组件的自定义事件
  emits: ['setage'],
  setup (props, context) {
    const addAge = () => context.emit('setage', 30)
    return {
      addAge
    }
  }
}
</script>

<style>

</style>
